<?php
namespace app\common\validate;

use think\Validate;

class Test extends Validate
{
  protected $rule = [
    // confirm:password、email都是tp的内置验证规则
    'username|管理员账户' => 'require',
    'password|密码' => 'require',
    'confirm-password|确认密码' => 'require|confirm:password',
    'nickname|昵称'=>'require',
    'email|邮箱'=>'require|email',
    'new-password|新密码' => 'require',

    // taskadd
    'name|考试任务'=>'require',
    'term|学期'=>'require',

    // 排监考
    'task_date|考试日期' => 'require',
    'begin_time|考试开始时间' => 'require',
    'end_time|考试结束时间' => 'require',
  ];

  protected $scene = [
    'taskadd'  =>  ['name','term'],
    'resultadd'  =>  ['task_date','begin_time','end_time']
  ];

  // 登录验证场景
  // public function sceneLogin()
  // {
  //   return $this->only(['username','password']);
  // }
  // 注册验证场景
//   public function sceneRegister() {
//     return $this->only(['username','password','confirm-password','nickname','email'])
//           ->append('username','unique:admin');
//   }
}